﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:c="clr-namespace:Sonce.Controls;assembly=Sonce.Controls">
  
  <Style TargetType="c:Toolbar">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:Toolbar">
          <Grid x:Name="RootElement">
            <StackPanel x:Name="ItemsContainer" Orientation="Horizontal" Background="{TemplateBinding Background}">
              <StackPanel.Resources>
                <ItemsPanelTemplate x:Key="ItemsPanelHorizontal">
                  <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
                <ItemsPanelTemplate x:Key="ItemsPanelVertical">
                  <StackPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
              </StackPanel.Resources>
              <ItemsPresenter />
            </StackPanel>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <StackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:ToolbarSeparator">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Foreground" Value="#FFB7B7B7" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate  TargetType="c:ToolbarSeparator">
          <Grid x:Name="RootElement">
            <Rectangle x:Name="VerticalLine" Height="20" Width="1" Margin="2,0,2,0" Fill="{TemplateBinding Foreground}" />
            <Rectangle x:Name="HorizontalLine" Height="1" Width="20" Margin="0,2,0,2" Fill="{TemplateBinding Foreground}" Visibility="Collapsed" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:ToolbarButton">
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Width" Value="24"/>
    <Setter Property="Height" Value="24"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:ToolbarButton">
          <Grid x:Name="RootElement">
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualState x:Name="Normal"/>
                <vsm:VisualState x:Name="MouseOver">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF6D6D6D"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Pressed">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF2D2D2D"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Disabled">
                  <Storyboard/>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard/>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused"/>
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" Background="#00000000" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3"/>
            <Image x:Name="contentPresenter" Source="{TemplateBinding Icon}" Margin="4" Stretch="None" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:ContextMenu">
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:ContextMenu">
          <Popup x:Name="Popup" VerticalOffset="20" HorizontalOffset="0" IsOpen="True">
            <Border BorderThickness="2" Width="100" Height="100" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Foreground}">
              <StackPanel x:Name="ItemsContainer">
                <ItemsPresenter />
              </StackPanel>
            </Border>
          </Popup>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:Menu">
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:Menu">
          <Grid x:Name="RootElement">
            <StackPanel x:Name="ItemsContainer" Orientation="Horizontal" Background="{TemplateBinding Background}">
              <StackPanel.Resources>
                <ItemsPanelTemplate x:Key="ItemsPanelHorizontal">
                  <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
                <ItemsPanelTemplate x:Key="ItemsPanelVertical">
                  <StackPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
              </StackPanel.Resources>
              <ItemsPresenter />
            </StackPanel>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <StackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:MenuSeparator">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Foreground" Value="#FFB7B7B7" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:MenuSeparator">
          <Grid x:Name="RootElement">
            <Grid x:Name="VerticalLine" Width="1" Margin="2,0,2,0" Background="{TemplateBinding Foreground}" />
            <Grid x:Name="HorizontalLine" Height="1" Margin="0,2,0,2" Background="{TemplateBinding Foreground}" Visibility="Collapsed" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:MenuItemHeader">
    <Setter Property="Background" Value="#FF1F3B53" />
    <Setter Property="Foreground" Value="#FF000000" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:MenuItemHeader">
          <Grid x:Name="RootElement" Background="Transparent">
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualState x:Name="Normal"/>
                <vsm:VisualState x:Name="MouseOver">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="RootElement" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFAAAAAA"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF3A3A3A"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Pressed">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="RootElement" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFAAAAAA"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF3A3A3A"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Disabled">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="RootElement" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="Transparent"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF7A7A7A"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="RootElement" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFAAAAAA"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF3A3A3A"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused"/>
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="12" x:Name="ArrowColumn" />
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="Content" Grid.Column="0" Foreground="White" FontSize="11" Margin="{TemplateBinding ContentPadding}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{TemplateBinding Content}" />
            <Path x:Name="Arrow" Grid.Column="1" Width="4" Height="8" Data="M0,0 L4,4 L0,8 Z" Fill="White" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{TemplateBinding ArrowVisibility}" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="c:MenuItem">
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="c:MenuItem">
          <Grid x:Name="RootElement" Background="Transparent">

            <!--ContentPresenter-->
            <c:MenuItemHeader x:Name="Header" Content="{TemplateBinding Header}" ContentPadding="{TemplateBinding ContentPadding}" ArrowContainerWidth="{TemplateBinding ArrowContainerWidth}" ArrowVisibility="{TemplateBinding ArrowVisibility}" />

            <!--Visibility="{TemplateBinding ArrowVisibility}"-->

            <Popup x:Name="Popup" VerticalOffset="20">
              <Border BorderThickness="2" BorderBrush="White" Background="Gray">
                <ItemsPresenter />
              </Border>
            </Popup>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>